package com.spzx.order.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.order.api.RemoteOrderService;
import com.spzx.order.api.domain.OrderInfo;
import org.mybatis.logging.Logger;
import org.mybatis.logging.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author ChenXing
 * @Description
 * @Create 2024/8/19 14:04
 */

@Component
public class RemoteOrderFallbackFactory implements FallbackFactory<RemoteOrderService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteOrderFallbackFactory.class);

    @Override
    public RemoteOrderService create(Throwable cause) {
        return new RemoteOrderService() {
            @Override
            public R<OrderInfo> getOrderInfoByOrderNo(String orderNo, String source) {
                return R.fail("获取用户购物车选中数据失败:" + cause.getMessage());
            }
        };
    }
}
